<template>
  <div>
    <h1>{{ title }}</h1>
    <h2>新闻</h2>
    <p>NewsID:{{$route.params.id}}</p>
    <Header/>
    <div>{{resUrl}}</div>
  </div>
</template>

<script>
import axios from 'axios'
import Header from '~/components/Header.vue'
export default {
  components: {
    Header
  },
  data () {
    return {
      title: 'Hello World!',
      resUrl:""
    }
  },
  /*
  validate ({ params }) {
    // Must be a number   刷新页面即可看到校验效果‘This page could not be found’
    return /^\d+$/.test(params.id)
  },*/

  async asyncData({route, error}) {
    if(process.client || process.title  === 'browser')
    return { sOotfitId: route.params.id }
  },
  mounted(){
    /* if(!this.ssr){
      axios.get('https://api.myjson.com/bins/mr6ma').then((res)=> {
        console.log(res);
      })
    } */
    this.resUrl = this.$route.query.resUrl

  },
  head () {
    return {
      title: this.title,
      meta: [
        { hid: 'description', name: 'description', content: 'My custom description' }
      ]
    }
  }

}
</script>



